<#macro topbar>
	<div class="topbar-container">
		<div class="topbar">
			<a class="topbar-changecity" href="${base}/">首页</a>
			<div class="topbar-right" id="welcome-info">
				<#if currentUser?exists>
					<span class="topbar-right-text">欢迎：</span>
					<span class="dropdown" id="topdropdown" >
						<a class="dropdown-trigger" id="top-user" href="<@UserSpaceUrl name=currentUser.name />">${currentUser.alias}</a>
						<ul class="dropdown-menu">
							<li><a href="<@UserSpaceUrl name=currentUser.name />" target="_blank">个人主页</a></li>
							<li><a href="<@UserSpaceUrl name=currentUser.name />/admin/message?filter=unread" id="messageCount">站内消息</a></li>
							<li><a href="<@UserSpaceUrl name=currentUser.name />/admin/post/create" target="_blank">发表博客</a></li>
							<li><a href="<@UserSpaceUrl name=currentUser.name />/t" target="_blank">碎碎念</a></li>
							<li><a href="<@UserSpaceUrl name=currentUser.name />/admin" target="_blank">管理</a></li>
						</ul>
					</span>
					<script type="text/javascript">
						$(document).ready(function(){
							$('#topdropdown').mouseover(function(){
								$(this).addClass('open');
							});
							
							$(document).click(function(){
								$('#topdropdown').removeClass('open');
							});
							
							m.getMessageCount(function(count){
								if(count && count > 0){
									$('#messageCount').append('&nbsp;<span class="notice-count">' + count + '</span>');
									$('#top-user').append('&nbsp;<span class="notice-count">' + count + '</span>');
								}
							});
						});
					</script>
					<a href="${base}/logout" id="logout">[退出]</a>
				<#else>
					<a href="${base}/register" rel="nofollow">注册</a> | <a href="${base}/login" rel="nofollow">登录</a>
				</#if>
			</div>
		</div>
	</div>
</#macro>